<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
    <title>FeatureLayer - 4.5</title>

    <link rel="stylesheet" href="https://js.arcgis.com/4.5/esri/css/main.css">
    <script src="https://js.arcgis.com/4.5/"></script>

    <style>
        html,
        body,
        #viewDiv {
            padding: 0;
            margin: 0;
            height: 100%;
            width: 100%;
        }
    </style>

    <script>
        require([
                "esri/Map",
                "esri/views/MapView",
                "esri/layers/FeatureLayer",
                "dojo/domReady!layers-featurelayer"
            ],
            function (Map, MapView,
                      FeatureLayer) {

                var map = new Map({});

                var view = new MapView({
                    container: "viewDiv",
                    map: map,
                    extent: { // autocasts as new Extent()
                        xmin: -180.0,
                        ymin: -90.0,
                        xmax: 180.0,
                        ymax: 90.0,
                        spatialReference: 4326
                    }
                });

                /********************
                 * Add feature layer
                 ********************/
                var featureLayer2 = new FeatureLayer({
                    url: "https://demo-master.boundlessgeo.com/geoserver/gsr/services/opengeo/FeatureServer/0",
                    outFields: ["*"]
                });

                map.add(featureLayer2);

            });

        require(["esri/config"], function (esriConfig) {
            esriConfig.request.corsEnabledServers.push("localhost:8080");
        });
    </script>
</head>

<body>
<div id="viewDiv"></div>
</body>

</html>
